<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <title>文章列表--layui后台管理模板 2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="resources/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="resources/css/public.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" id="dataFrm">
    <div class="layui-form-item layui-row">
        <div class="layui-input-block">
            商品名称<input type="text" id="name" class="layui-input name" >
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-input-block">
            价格<input type="text" class="layui-input price" >
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-input-block">
            商品说明<input type="text" class="layui-input state" >
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-input-block">
            创建时间<input class="layui-input time" >
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-input-block" style="width: 50px">
            <!--这是一个隐藏域，存放父页面传过来的图片链接，下面会对其进行处理成数组的形式，最后遍历数组，展现图片-->
            图片<input id="pic"  class="layui-input pic" type="hidden">

        </div>
    </div>
</form>


<script type="text/javascript" src="resources/layui/layui.js"></script>
<script th:inline="none">
    layui.use(['form','layer','laydate','table','laytpl','upload'],function() {
        var form = layui.form
        layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laydate = layui.laydate,
            laytpl = layui.laytpl,
            table = layui.table,
            upload=layui.upload;
        $(function () {
            //得到所有图片
            let picList=$('#pic').val();
            console.log(picList);
            var picArray=picList.split(',');
            //得到商品的图片数组
            console.log(picArray);
            for (var i=0;i<picArray.length;i++){
                document.querySelector("pic").createElement("image").innerHTML("22222222222222")
            }

        })



    });
</script>
</body>
</html>